#ifndef _SRC_DFU_AWI_DFU_H_
#define _SRC_DFU_AWI_DFU_H_

#include "awi_dfu_unpack.h"
#include "awi_dfu_pack.h"

#ifdef __cplusplus
extern "C" {
#endif
	typedef void(*awi_dfu_recv_notify_func)(void *notify_ths, uint16_t ctrl, uint16_t dst, uint16_t src, uint16_t version, const uint8_t *payload, int bytes);
	typedef void(*awi_dfu_send_notify_func)(void *notify_ths, const uint8_t *data, int bytes);

	typedef struct awi_dfu awi_dfu_t;
	struct awi_dfu {
		awi_dfu_unpack_t unpack;
		awi_dfu_recv_notify_func recv_func;
		void *recv_ths;
		awi_dfu_send_notify_func send_func;
		void *send_ths;
	};

	awi_dfu_t* awi_dfu_new();
	void awi_dfu_del(awi_dfu_t *dfu);

	void awi_dfu_send(awi_dfu_t *dfu, uint16_t ctrl, uint16_t dst, uint16_t src, const uint8_t *payload, int bytes);
	void awi_dfu_set_send_notify(awi_dfu_t *dfu, void *notify_ths, awi_dfu_send_notify_func notify_func);

	void awi_dfu_recv(awi_dfu_t *dfu, const uint8_t *data, int bytes);
	void awi_dfu_set_recv_notify(awi_dfu_t *dfu, void *notify_ths, awi_dfu_recv_notify_func notify_func);

#ifdef __cplusplus
};
#endif
#endif /* _SRC_DFU_AWI_DFU_H_ */